package Leetcode.ArrayAndLinkedList.reverseKGroup25;

public class ListNode {
    int val;
    ListNode next;

    public ListNode() {
    }

    ListNode(int x) {
        val = x;
    }

    ListNode(int[] nums) {
        if (nums == null && nums.length <= 0) {
            return;
        }
        this.val = nums[0];
        ListNode head = this;
        for (int i = 1; i < nums.length; i++) {
            ListNode node = new ListNode(nums[i]);
            head.next = node;
            head = head.next;
        }

    }

    @Override
    public String toString() {
        StringBuffer str = new StringBuffer();
        ListNode head = this;
        while (head != null) {
            str.append(head.val + "-->");
            head = head.next;
        }
        str.append("NULL");
        return str.toString();
    }
}
